#ifndef _HTTPMESSAGE_HPP_
#define _HTTPMESSAGE_HPP_

#include "jhdefs.hpp"
#include "types.hpp"
#include "net/MessageHeader.hpp"
#include <string>

NET_NAMESPACE_BEGIN

class CMediaType;
class CHTTPMessage : public CMessageHeader
{
public:
	void setVersion(const std::string& version);
	const std::string& getVersion() const;

	void setContentLength(std::streamsize length);
	std::streamsize getContentLength() const;

#if defined(JH_HAVE_INT64)	
	void setContentLength64(Int64 length);
	Int64 getContentLength64() const;
#endif

	bool hasContentLength() const;

	void setTransferEncoding(const std::string& transferEncoding);
	const std::string& getTransferEncoding() const;

	void setChunkedTransferEncoding(bool flag);
	bool getChunkedTransferEncoding() const;

	void setContentType(const std::string& mediaType);
	void setContentType(const CMediaType& mediaType);	
	const std::string& getContentType() const;

	void setKeepAlive(bool keepAlive);
	bool getKeepAlive() const;

	static const std::string HTTP_1_0;
	static const std::string HTTP_1_1;

	static const std::string IDENTITY_TRANSFER_ENCODING;
	static const std::string CHUNKED_TRANSFER_ENCODING;

	static const int         UNKNOWN_CONTENT_LENGTH;
	static const std::string UNKNOWN_CONTENT_TYPE;

	static const std::string CONTENT_LENGTH;
	static const std::string CONTENT_TYPE;
	static const std::string TRANSFER_ENCODING;
	static const std::string CONNECTION;

	static const std::string CONNECTION_KEEP_ALIVE;
	static const std::string CONNECTION_CLOSE;

	static const std::string EMPTY;

protected:
	CHTTPMessage();
	CHTTPMessage(const std::string& version);
	virtual ~CHTTPMessage();

private:
	CHTTPMessage(const CHTTPMessage&);
	CHTTPMessage& operator = (const CHTTPMessage&);

	std::string m_version;
};


NET_NAMESPACE_END

#endif
